﻿<cc:BaseUserControl
             xmlns:cc="clr-namespace:MonitorTerminal.UserControls"
    x:Class="MonitorTerminal.UserControls.UpdaterUC"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
    xmlns:MonitorTerminal_ValueConverter="clr-namespace:MonitorTerminal.ValueConverter" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300" Loaded="BaseUserControl_Loaded">
	<UserControl.Resources>
		<MonitorTerminal_ValueConverter:DefaultToEmptyConverter x:Key="DefaultToEmptyConverter"/>
    <Style x:Key="itemstyle" TargetType="{x:Type ListViewItem}">
        <EventSetter Event="MouseDoubleClick" Handler="HandleDoubleClick" />
    </Style>
	    <DataTemplate x:Key="ListViewHeaderTemplateDescendingSorting">
        <DockPanel>
            <TextBlock Text="{Binding}"/>
        <Path x:Name="arrow"
            StrokeThickness = "1" 
            Fill = "gray"
            Data = "M 5,10 L 15,10 L 10,5 L 5,10"/>
    </DockPanel>
    </DataTemplate>
<DataTemplate x:Key="ListViewHeaderTemplateAscendingSorting">
<DockPanel>
    <TextBlock Text="{Binding }"/>
    <Path x:Name="arrow"
    StrokeThickness = "1" 
    Fill = "gray"
    Data = "M 5,5 L 10,10 L 15,5 L 5,5"/>
</DockPanel>
</DataTemplate>

<DataTemplate x:Key="ListViewHeaderTemplateNoSorting">
    <DockPanel>
        <TextBlock Text="{Binding }"/>
    </DockPanel>
</DataTemplate>

</UserControl.Resources>
    <Grid x:Name="gridRoot" Background="#FFFDF9F9">
    	<TextBox x:Name="txtPath" Height="20" Margin="8,17,77,0" VerticalAlignment="Top"/>
    	<Button x:Name="btnBrowser" Content="浏览" HorizontalAlignment="Right" Height="20" Margin="0,17,8,0" VerticalAlignment="Top" Width="55"/>
    	<Button x:Name="btnUpLoad" Content="上传" Height="26" Margin="68,88,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="66"/>
    	<Label x:Name="lblProgress" Height="33" Margin="8,51,8,0" VerticalAlignment="Top"/>
    	<Button x:Name="btnUpdateFiles" Content="更新" HorizontalAlignment="Right" Height="26" Margin="0,88,77,0" VerticalAlignment="Top" Width="65"/>
    	<ListView x:Name="lvDirectory" Margin="8,130,8,8" ItemContainerStyle="{StaticResource itemstyle}" GridViewColumnHeader.Click="GridViewColumnHeader_Click">
    		<ListView.View>
    			<GridView>
    				<GridViewColumn Header="名称" DisplayMemberBinding="{Binding Name}"/>
    				<GridViewColumn Header="修改日期" DisplayMemberBinding="{Binding LastWriteTime, Converter={StaticResource DefaultToEmptyConverter}}"/>
    				<GridViewColumn Header="大小" DisplayMemberBinding="{Binding Length, Converter={StaticResource DefaultToEmptyConverter}}"/>
    			</GridView>
    		</ListView.View>
    	</ListView>
            
    </Grid>
</cc:BaseUserControl>
